\(\int \sec ^m(e+f x) (m-(1+m) \sec ^2(e+f x)) \, dx\) [25]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 24, antiderivative size = 21 \[ \int \sec ^m(e+f x) \left (m-(1+m) \sec ^2(e+f x)\right ) \, dx=-\frac {\sec ^{1+m}(e+f x) \sin (e+f x)}{f} \]

[Out]

-sec(f*x+e)^(1+m)*sin(f*x+e)/f

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 21, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.042, Rules used = {4128} \[ \int \sec ^m(e+f x) \left (m-(1+m) \sec ^2(e+f x)\right ) \, dx=-\frac {\sin (e+f x) \sec ^{m+1}(e+f x)}{f} \]

[In]

Int[Sec[e + f*x]^m*(m - (1 + m)*Sec[e + f*x]^2),x]

[Out]

-((Sec[e + f*x]^(1 + m)*Sin[e + f*x])/f)

Rule 4128

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> Simp[A*Cot[e
+ f*x]*((b*Csc[e + f*x])^m/(f*m)), x] /; FreeQ[{b, e, f, A, C, m}, x] && EqQ[C*m + A*(m + 1), 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {\sec ^{1+m}(e+f x) \sin (e+f x)}{f} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.39 (sec) , antiderivative size = 107, normalized size of antiderivative = 5.10 \[ \int \sec ^m(e+f x) \left (m-(1+m) \sec ^2(e+f x)\right ) \, dx=\frac {\csc (e+f x) \sec ^{-1+m}(e+f x) \left ((2+m) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {m}{2},\frac {2+m}{2},\sec ^2(e+f x)\right )-(1+m) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2+m}{2},\frac {4+m}{2},\sec ^2(e+f x)\right ) \sec ^2(e+f x)\right ) \sqrt {-\tan ^2(e+f x)}}{f (2+m)} \]

[In]

Integrate[Sec[e + f*x]^m*(m - (1 + m)*Sec[e + f*x]^2),x]

[Out]

(Csc[e + f*x]*Sec[e + f*x]^(-1 + m)*((2 + m)*Hypergeometric2F1[1/2, m/2, (2 + m)/2, Sec[e + f*x]^2] - (1 + m)*
Hypergeometric2F1[1/2, (2 + m)/2, (4 + m)/2, Sec[e + f*x]^2]*Sec[e + f*x]^2)*Sqrt[-Tan[e + f*x]^2])/(f*(2 + m)
)

Maple [A] (verified)

Time = 1.15 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.90

method result size
parallelrisch \(\frac {2 \tan \left (\frac {f x}{2}+\frac {e}{2}\right ) \left (\frac {1}{\cos \left (f x +e \right )}\right )^{m}}{f \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-1\right )}\) \(40\)
risch \(\frac {i \left ({\mathrm e}^{i \left (f x +e \right )}\right )^{m} \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{-m} 2^{m} \left ({\mathrm e}^{\frac {i \operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \operatorname {csgn}\left (\frac {i {\mathrm e}^{i \left (f x +e \right )}}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )^{2} \pi m}{2}} {\mathrm e}^{-\frac {i \operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \operatorname {csgn}\left (\frac {i {\mathrm e}^{i \left (f x +e \right )}}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \operatorname {csgn}\left (i {\mathrm e}^{i \left (f x +e \right )}\right ) \pi m}{2}} {\mathrm e}^{-\frac {i \operatorname {csgn}\left (\frac {i {\mathrm e}^{i \left (f x +e \right )}}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )^{3} \pi m}{2}} {\mathrm e}^{\frac {i \operatorname {csgn}\left (\frac {i {\mathrm e}^{i \left (f x +e \right )}}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )^{2} \operatorname {csgn}\left (i {\mathrm e}^{i \left (f x +e \right )}\right ) \pi m}{2}} {\mathrm e}^{2 i f x} {\mathrm e}^{2 i e}-{\mathrm e}^{-\frac {i \operatorname {csgn}\left (\frac {i {\mathrm e}^{i \left (f x +e \right )}}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right ) \pi m \left (-\operatorname {csgn}\left (\frac {i {\mathrm e}^{i \left (f x +e \right )}}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )+\operatorname {csgn}\left (i {\mathrm e}^{i \left (f x +e \right )}\right )\right ) \left (-\operatorname {csgn}\left (\frac {i {\mathrm e}^{i \left (f x +e \right )}}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )+\operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 i \left (f x +e \right )}+1}\right )\right )}{2}}\right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}\) \(378\)

[In]

int(sec(f*x+e)^m*(m-(1+m)*sec(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

2/f*tan(1/2*f*x+1/2*e)*(1/cos(f*x+e))^m/(tan(1/2*f*x+1/2*e)^2-1)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.38 \[ \int \sec ^m(e+f x) \left (m-(1+m) \sec ^2(e+f x)\right ) \, dx=-\frac {\frac {1}{\cos \left (f x + e\right )}^{m} \sin \left (f x + e\right )}{f \cos \left (f x + e\right )} \]

[In]

integrate(sec(f*x+e)^m*(m-(1+m)*sec(f*x+e)^2),x, algorithm="fricas")

[Out]

-(1/cos(f*x + e))^m*sin(f*x + e)/(f*cos(f*x + e))

Sympy [F]

\[ \int \sec ^m(e+f x) \left (m-(1+m) \sec ^2(e+f x)\right ) \, dx=- \int \left (- m \sec ^{m}{\left (e + f x \right )}\right )\, dx - \int \sec ^{2}{\left (e + f x \right )} \sec ^{m}{\left (e + f x \right )}\, dx - \int m \sec ^{2}{\left (e + f x \right )} \sec ^{m}{\left (e + f x \right )}\, dx \]

[In]

integrate(sec(f*x+e)**m*(m-(1+m)*sec(f*x+e)**2),x)

[Out]

-Integral(-m*sec(e + f*x)**m, x) - Integral(sec(e + f*x)**2*sec(e + f*x)**m, x) - Integral(m*sec(e + f*x)**2*s
ec(e + f*x)**m, x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 283 vs. \(2 (21) = 42\).

Time = 0.43 (sec) , antiderivative size = 283, normalized size of antiderivative = 13.48 \[ \int \sec ^m(e+f x) \left (m-(1+m) \sec ^2(e+f x)\right ) \, dx=\frac {2^{m} \cos \left (-{\left (f x + e\right )} {\left (m + 2\right )} + m \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) \sin \left (2 \, f x + 2 \, e\right ) - 2^{m} \cos \left (-{\left (f x + e\right )} m + m \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) \sin \left (2 \, f x + 2 \, e\right ) + {\left (2^{m} \cos \left (2 \, f x + 2 \, e\right ) + 2^{m}\right )} \sin \left (-{\left (f x + e\right )} {\left (m + 2\right )} + m \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) - {\left (2^{m} \cos \left (2 \, f x + 2 \, e\right ) + 2^{m}\right )} \sin \left (-{\left (f x + e\right )} m + m \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right )}{{\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, m} f} \]

[In]

integrate(sec(f*x+e)^m*(m-(1+m)*sec(f*x+e)^2),x, algorithm="maxima")

[Out]

(2^m*cos(-(f*x + e)*(m + 2) + m*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1))*sin(2*f*x + 2*e) - 2^m*cos(-(
f*x + e)*m + m*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1))*sin(2*f*x + 2*e) + (2^m*cos(2*f*x + 2*e) + 2^m
)*sin(-(f*x + e)*(m + 2) + m*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) - (2^m*cos(2*f*x + 2*e) + 2^m)*s
in(-(f*x + e)*m + m*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)))/((cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^
2 + 2*cos(2*f*x + 2*e) + 1)*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*m)*f)

Giac [F]

\[ \int \sec ^m(e+f x) \left (m-(1+m) \sec ^2(e+f x)\right ) \, dx=\int { -{\left ({\left (m + 1\right )} \sec \left (f x + e\right )^{2} - m\right )} \sec \left (f x + e\right )^{m} \,d x } \]

[In]

integrate(sec(f*x+e)^m*(m-(1+m)*sec(f*x+e)^2),x, algorithm="giac")

[Out]

integrate(-((m + 1)*sec(f*x + e)^2 - m)*sec(f*x + e)^m, x)

Mupad [B] (verification not implemented)

Time = 15.39 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.76 \[ \int \sec ^m(e+f x) \left (m-(1+m) \sec ^2(e+f x)\right ) \, dx=-\frac {\sin \left (2\,e+2\,f\,x\right )\,{\left (\frac {1}{\cos \left (e+f\,x\right )}\right )}^m}{f\,\left (\cos \left (2\,e+2\,f\,x\right )+1\right )} \]

[In]

int((m - (m + 1)/cos(e + f*x)^2)*(1/cos(e + f*x))^m,x)

[Out]

-(sin(2*e + 2*f*x)*(1/cos(e + f*x))^m)/(f*(cos(2*e + 2*f*x) + 1))